﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="Profile.aspx.vb" Inherits="WSCC_GlutenfreeKent.Profile" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <asp:GridView ID="GridView1" runat="server" DataSourceID="SqlDataSource1" 
        AutoGenerateColumns="False" DataKeyNames="ID" Height="116px" Width="98%">
        <Columns>
            <asp:BoundField DataField="UserName" HeaderText="UserName" 
                SortExpression="UserName" />
            <asp:BoundField DataField="Hometown" HeaderText="Hometown" 
                SortExpression="Hometown" />
            <asp:BoundField DataField="FirstName" HeaderText="FirstName" 
                SortExpression="FirstName" />
            <asp:BoundField DataField="LastName" HeaderText="LastName" 
                SortExpression="LastName" />
            <asp:BoundField DataField="Details" HeaderText="Details" 
                SortExpression="Details" />
            <asp:ImageField DataImageUrlField="Picture" HeaderText="Picture" 
               >
                <ControlStyle CssClass="userPhoto" Height="100px" Width="100px" />
            </asp:ImageField>
            <asp:BoundField DataField="MyFavouriteShop" HeaderText="My Favourite Shop" 
                SortExpression="MyFavouriteShop" />
            <asp:BoundField DataField="MyFavouriteRestaurant" 
                HeaderText="My Favourite Restaurant" SortExpression="MyFavouriteRestaurant" />
            <asp:BoundField DataField="GlutenfreeSince" HeaderText="Gluten-free Since" 
                SortExpression="GlutenfreeSince" DataFormatString="{0:d}" 
                HtmlEncode="False" >
            <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
            </asp:BoundField>
        </Columns>
    </asp:GridView>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:ConnectionStringRestaurants %>" 
        ProviderName="<%$ ConnectionStrings:ConnectionStringRestaurants.ProviderName %>" 
        SelectCommand="SELECT * FROM [Profile] WHERE ([UserName] = ?)">
        <SelectParameters>
            <asp:QueryStringParameter Name="UserName" QueryStringField="UserName" 
                Type="String" />
        </SelectParameters>
    </asp:SqlDataSource>
    <asp:Button ID="btn_EditProfile" runat="server" 
        PostBackUrl="~/Account/EditProfile.aspx" Text="Edit Profile" />
    <br />
    <br />
    <br />
    <asp:ListView ID="ListView1" runat="server" DataKeyNames="ID" 
        DataSourceID="SqlDataSource2" GroupItemCount="4" 
        style="margin-right: 116px" >
        <AlternatingItemTemplate>
            <td runat="server" style="background-color: #FAFAD2;color: #284775; width:250px">

                <a href='Profile.aspx?UserName=<%# Eval("UserName") %>' >
                <img alt="" src='<%# Eval("Picture") %>' />
                </a>
                <br />UserName:
                <asp:Label ID="UserNameLabel" runat="server" Text='<%# Eval("UserName") %>' />
                
                <br />Hometown:
                <asp:Label ID="HometownLabel" runat="server" Text='<%# Eval("Hometown") %>' />
               
                <br />GlutenfreeSince:
                <asp:Label ID="GlutenfreeSinceLabel" runat="server" 
                    Text='<%# Eval("GlutenfreeSince") %>' />
                <br />
            </td>
        </AlternatingItemTemplate>
        <EditItemTemplate>
            <td runat="server" style="background-color: #FFCC66;color: #000080;">
                ID:
                <asp:Label ID="IDLabel1" runat="server" Text='<%# Eval("ID") %>' />
                <br />FirstName:
                <asp:TextBox ID="FirstNameTextBox" runat="server" 
                    Text='<%# Bind("FirstName") %>' />
                <br />LastName:
                <asp:TextBox ID="LastNameTextBox" runat="server" 
                    Text='<%# Bind("LastName") %>' />
                <br />Details:
                <asp:TextBox ID="DetailsTextBox" runat="server" Text='<%# Bind("Details") %>' />
                <br />Picture:
                <asp:TextBox ID="PictureTextBox" runat="server" Text='<%# Bind("Picture") %>' />
                <br />UserName:
                <asp:TextBox ID="UserNameTextBox" runat="server" 
                    Text='<%# Bind("UserName") %>' />
                <br />MyFavouriteRestaurant:
                <asp:TextBox ID="MyFavouriteRestaurantTextBox" runat="server" 
                    Text='<%# Bind("MyFavouriteRestaurant") %>' />
                <br />Hometown:
                <asp:TextBox ID="HometownTextBox" runat="server" 
                    Text='<%# Bind("Hometown") %>' />
                <br />MyFavouriteShop:
                <asp:TextBox ID="MyFavouriteShopTextBox" runat="server" 
                    Text='<%# Bind("MyFavouriteShop") %>' />
                <br />GlutenfreeSince:
                <asp:TextBox ID="GlutenfreeSinceTextBox" runat="server" 
                    Text='<%# Bind("GlutenfreeSince") %>' />
                <br />
                <asp:Button ID="UpdateButton" runat="server" CommandName="Update" 
                    Text="Update" />
                <br />
                <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" 
                    Text="Cancel" />
                <br />
            </td>
        </EditItemTemplate>
        <EmptyDataTemplate>
            <table runat="server" 
                style="background-color: #FFFFFF;border-collapse: collapse;border-color: #999999;border-style:none;border-width:1px;">
                <tr>
                    <td>
                        No data was returned.</td>
                </tr>
            </table>
        </EmptyDataTemplate>
        <EmptyItemTemplate>
<td runat="server" />
        </EmptyItemTemplate>
        <GroupTemplate>
            <tr ID="itemPlaceholderContainer" runat="server">
                <td ID="itemPlaceholder" runat="server">
                </td>
            </tr>
        </GroupTemplate>
        <InsertItemTemplate>
            <td runat="server" style="">
                FirstName:
                <asp:TextBox ID="FirstNameTextBox" runat="server" 
                    Text='<%# Bind("FirstName") %>' />
                <br />LastName:
                <asp:TextBox ID="LastNameTextBox" runat="server" 
                    Text='<%# Bind("LastName") %>' />
                <br />Details:
                <asp:TextBox ID="DetailsTextBox" runat="server" Text='<%# Bind("Details") %>' />
                <br />Picture:
                <asp:TextBox ID="PictureTextBox" runat="server" Text='<%# Bind("Picture") %>' />
                <br />UserName:
                <asp:TextBox ID="UserNameTextBox" runat="server" 
                    Text='<%# Bind("UserName") %>' />
                <br />MyFavouriteRestaurant:
                <asp:TextBox ID="MyFavouriteRestaurantTextBox" runat="server" 
                    Text='<%# Bind("MyFavouriteRestaurant") %>' />
                <br />Hometown:
                <asp:TextBox ID="HometownTextBox" runat="server" 
                    Text='<%# Bind("Hometown") %>' />
                <br />MyFavouriteShop:
                <asp:TextBox ID="MyFavouriteShopTextBox" runat="server" 
                    Text='<%# Bind("MyFavouriteShop") %>' />
                <br />GlutenfreeSince:
                <asp:TextBox ID="GlutenfreeSinceTextBox" runat="server" 
                    Text='<%# Bind("GlutenfreeSince") %>' />
                <br />
                <asp:Button ID="InsertButton" runat="server" CommandName="Insert" 
                    Text="Insert" />
                <br />
                <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" 
                    Text="Clear" />
                <br />
            </td>
        </InsertItemTemplate>
        <ItemTemplate>
            <td runat="server" style="background-color: #FFFBD6;color: #333333; width:250px">
                <a href='Profile.aspx?UserName=<%# Eval("UserName") %>' >
                <img alt="" src='<%# Eval("Picture") %>' />
                </a>
                <br />UserName:
                <asp:Label ID="UserNameLabel" runat="server" Text='<%# Eval("UserName") %>' />
                
                <br />Hometown:
                <asp:Label ID="HometownLabel" runat="server" Text='<%# Eval("Hometown") %>' />
               
                <br />GlutenfreeSince:
                <asp:Label ID="GlutenfreeSinceLabel" runat="server" 
                    Text='<%# Eval("GlutenfreeSince") %>' />
                <br />
            </td>
        </ItemTemplate>
        <LayoutTemplate>
       
            <table runat="server">
                <tr runat="server">
                    <td runat="server">
                        <table ID="groupPlaceholderContainer" runat="server" border="1" 
                            style="background-color: #FFFFFF;border-collapse: collapse;border-color: #999999;border-style:none;border-width:1px;font-family: Verdana, Arial, Helvetica, sans-serif;">
                            <tr ID="groupPlaceholder" runat="server">
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr runat="server">
                    <td runat="server" 
                        style="text-align: center;background-color: #FFCC66;font-family: Verdana, Arial, Helvetica, sans-serif;color: #333333;">
                        <asp:DataPager ID="DataPager1" runat="server" PageSize="20">
                        <Fields> 
                        <asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="true" ShowLastPageButton="true" />
                        </Fields></asp:DataPager>
                    </td>
                </tr>
            </table>
            
        </LayoutTemplate>
        <SelectedItemTemplate>
            <td runat="server" 
                style="background-color: #FFCC66;font-weight: bold;color: #000080;">
                ID:
                <asp:Label ID="IDLabel" runat="server" Text='<%# Eval("ID") %>' />
                <br />FirstName:
                <asp:Label ID="FirstNameLabel" runat="server" Text='<%# Eval("FirstName") %>' />
                <br />LastName:
                <asp:Label ID="LastNameLabel" runat="server" Text='<%# Eval("LastName") %>' />
                <br />Details:
                <asp:Label ID="DetailsLabel" runat="server" Text='<%# Eval("Details") %>' />
                <br />Picture:
                <asp:Label ID="PictureLabel" runat="server" Text='<%# Eval("Picture") %>' />
                <br />UserName:
                <asp:Label ID="UserNameLabel" runat="server" Text='<%# Eval("UserName") %>' />
                <br />MyFavouriteRestaurant:
                <asp:Label ID="MyFavouriteRestaurantLabel" runat="server" 
                    Text='<%# Eval("MyFavouriteRestaurant") %>' />
                <br />Hometown:
                <asp:Label ID="HometownLabel" runat="server" Text='<%# Eval("Hometown") %>' />
                <br />MyFavouriteShop:
                <asp:Label ID="MyFavouriteShopLabel" runat="server" 
                    Text='<%# Eval("MyFavouriteShop") %>' />
                <br />GlutenfreeSince:
                <asp:Label ID="GlutenfreeSinceLabel" runat="server" 
                    Text='<%# Eval("GlutenfreeSince") %>' />
                <br />
            </td>
        </SelectedItemTemplate>
    </asp:ListView>
    <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
        ConnectionString="<%$ ConnectionStrings:ConnectionStringRestaurants %>" 
        ProviderName="<%$ ConnectionStrings:ConnectionStringRestaurants.ProviderName %>" 
        SelectCommand="SELECT * FROM [Profile]"></asp:SqlDataSource>
    <br />
    <br />
    <br />

    </asp:Content>
